Skip to content

Building buildings#17

Open
mikedao wants to merge 8 commits intomainfrom
building-buildings
Open

Building buildings#17
mikedao wants to merge 8 commits intomainfrom
building-buildings

Conversation

@mikedao
Copy link
Owner

@mikedao mikedao commented Jun 19, 2025

🚀 Building Construction & Modal Magic! 🏗️✨

What’s New in the Voidfront Realms Elite Galaxy?

This PR brings a whole new dimension to your empire management experience—literally! Introducing the Building Construction System with a shiny, accessible, and progressively enhanced modal interface. Here’s what’s landed:


🏢 Building System

  • Construct, upgrade, and demolish buildings in your star systems!
  • Four core building types seeded:
    • Government Administration
    • Mining Facility
    • Power Plant
    • Research Laboratory
  • Building status updates handled by the maintenance job (construction, demolition, operational).

🧑‍💻 Progressive Enhancement & Accessibility

  • Modal confirmation for building construction is now fully accessible and works with or without JavaScript.
  • Feature tests updated to use js: true and scoped modal interactions—no more test_env? hacks!
  • All UI changes follow accessibility best practices.

🧪 Testing & Dev Experience

  • Feature tests for building construction and demolition are robust and reliable.
  • DatabaseCleaner with truncation ensures test isolation.
  • README updated with the latest setup, seeding, and testing instructions.
  • Prerequisites now reflect the actual dev environment (Ruby 3.4.4, Redis 8.0.2, Node 22.15.0, Yarn 1.22.19).

🧹 Refactors & Cleanups

  • Removed all instances of test_env? for a cleaner, more maintainable codebase.
  • Modal and form logic is now consistent across all environments.

🛠️ How to Test

  1. Pull the branch and run bin/rails db:seed to get the new building types.
  2. Try constructing and demolishing buildings in your star systems.
  3. Run the test suite with bundle exec rspec—all feature tests should pass!

🌌 Why This Rocks

  • Empires now feel alive and dynamic with real construction projects.
  • The UI is more interactive and accessible for all users.
  • The codebase is cleaner, more maintainable, and ready for future features (like shipyards and research!).

Let’s build the future—one star system at a time! 🪐


mikedao added 8 commits May 20, 2025 16:38
Create BuildingType model with validations and methods for cost, construction time, and effects based on level. Add migration to create building_types table with necessary fields. Include FactoryBot factory for building types and RSpec tests to validate model behavior and instance methods.
Create Building model with associations, validations, and methods for construction and demolition progress. Add migration to create buildings table with necessary fields and foreign keys. Include FactoryBot factory for buildings and RSpec tests to validate model behavior and instance methods.
Update the level validation to ensure only integer values greater than zero are accepted. Modify the current_effect method to retrieve effects based on the building's level instead of a direct multiplication. Adjust related tests to reflect the change in error messaging for unique building types within star systems.
…stem model

Refactor the tax revenue calculation in MaintenanceJob to sum tax income from each star system using the new calculate_tax_income method. Add methods for calculating tax income and tax modifiers based on operational buildings in the StarSystem model. Update tests to validate the new functionality and ensure accurate tax calculations.
…Gemfile.lock; enhance MaintenanceJob to manage building statuses during maintenance tasks with corresponding tests.
Implement BuildingsController to handle building creation and destruction with necessary authorization checks. Update routes to include buildings resource. Enhance star system edit view to display available buildings, their costs, and construction progress. Add modal for confirming building construction. Update Gemfile to include selenium-webdriver for testing. Add feature tests for building construction and demolition scenarios, ensuring proper resource management and user feedback.
…nd tests

Remove unused database_cleaner dependencies from Gemfile.lock. Update README to reflect changes in Ruby version and add details about the new building system, including setup instructions and testing notes. Modify the building construction confirmation modal for improved visibility and update feature tests to ensure proper functionality of the building construction process.
Add frozen string literal comment to multiple files for performance optimization. Standardize string delimiters to single quotes throughout the codebase. Clean up whitespace and formatting in various files, including controllers, models, and views, to improve readability and maintainability. Update tests to reflect these changes and ensure consistent behavior across the application.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant